import React, { Component } from 'react'
import { NavLink, Route, Switch, Redirect } from 'react-router-dom'
import list from './router/routerConfig'
import './App.css'

export default class App extends Component {
    render() {
        return (
            <div>
                <main>
                    <Switch>
                    {
                        list.map((item, index) => {
                            return <Route path = { item.path } component = { item.component } key={index}/>
                        })
                    }
                    </Switch>
                </main>

                <footer>
                    {
                        list.map((item, index) => {
                            return <NavLink to={item.path} key={index}>
                                {item.title}
                            </NavLink>
                        })
                    }
                </footer>
                {/* <Redirect to="/home"/> */}
            </div>
        )
    }
}
